package com.scy.java.io.convert;

import java.io.*;

public class ConvertStreamReadAndWriterTest {
    public static void main(String[] args) {
        try {
            InputStreamReader isr =
                    new InputStreamReader(
                            new FileInputStream("d:/copy_出师表1.txt"));
            OutputStreamWriter osw =
                    new OutputStreamWriter(
                            new FileOutputStream("出师表.txt"));

//            {
//                int len ;
//                while ((len = isr.read()) != -1){
//                    osw.write((char) len);
//                }
//            }
            {
                int len ;
                char[] chars = new char[1024];
                while ((len = isr.read(chars)) != -1){
                    osw.write(chars,0, len);
                }
            }
            //文件写入完毕
            osw.close();
            isr.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
